package cn.yunbamboos.token.serializer;

import com.alibaba.fastjson2.JSON;
import io.jsonwebtoken.io.AbstractSerializer;
import io.jsonwebtoken.lang.Assert;

import java.io.OutputStream;

public class TokenSerializer<T> extends AbstractSerializer<T> {

    @Override
    protected void doSerialize(T t, OutputStream out) throws Exception {
        Assert.notNull(out, "OutputStream cannot be null.");
        out.write(JSON.toJSONString(t).getBytes());
    }

}
